package com.admon;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ListView;

import com.pproducto.MainActivity;
import com.pproducto.R;

public class menuCatego extends Activity {
	
	String[] opciones = {"Buscar categoria","Ingresar nueva categoria","Modificar categoria existente", "Eliminar categoria"};
	ListView lista;
	
	@Override
	protected void onCreate (Bundle savedInstanceState){
		super.onCreate(savedInstanceState);
			setContentView(R.layout.menu_catego);
			
			lista =(ListView)findViewById(R.id.listView1);
			
			ArrayAdapter<String> adaptador = new ArrayAdapter<String> (getApplicationContext(), android.R.layout.simple_list_item_1, opciones);
			lista.setAdapter(adaptador);
			
			lista.setOnItemClickListener(new AdapterView.OnItemClickListener() {

				@Override
				public void onItemClick(AdapterView<?> AdapterView, View view, int i, long l) 
				{		
					switch (i)
					 {
					    case 0: //Buscar categoria
					    	Intent in = new Intent(menuCatego.this, buscarCatego.class);
							startActivity(in);
						break;
					
					    case 1: //Ingresar nueva categoria
					    	Intent in2 = new Intent(menuCatego.this, ingresarCatego.class);
							startActivity(in2);
						break;
					
					    case 2: //Modificar categoria existente
					    	Intent in3 = new Intent(menuCatego.this, modificarCatego.class);
					    	startActivity(in3);
						break;	
						
					    case 3: //Eliminar categoria
					    	Intent in4 = new Intent(menuCatego.this, eliminarCatego.class);
					    	startActivity(in4);
						break;
					  }
				
				 }
			});
	}

}
